package com.jay.publisher.app.kit

import android.content.Context
import com.jay.publisher.app.R
import java.io.File

/**
 *
 * @author zhouxu
 * @email 1419982188@qq.com
 * @date 2021/3/23
 */
object DirUtils {

    /**
     * 获取拍照图片保存的目录
     */
    fun getPictureOutputDirectory(context: Context): File {
        val applicationContext = context.applicationContext
        val mediaDir = context.externalMediaDirs.firstOrNull()?.let {
            File(it, applicationContext.resources.getString(R.string.app_name)).apply { mkdirs() }
        }
        return if (mediaDir != null && mediaDir.exists()) mediaDir else applicationContext.filesDir
    }
}